package cn.itsource.pethome.base.util;

import lombok.Data;

@Data
public class AjaxResult {
    private boolean state = true;
    private String message = "操作成功";

    //私有化构造方法
    private AjaxResult(){
    }

    public static AjaxResult me(){
        return new AjaxResult();
    }

    public static AjaxResult success(){
        return new AjaxResult();
    }

    public static AjaxResult error(){
        return new AjaxResult().setState(false).setMessage("操作失败");
    }

    public AjaxResult setState(boolean state) {
        this.state = state;
        return this;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }
}
